package com.acme;

public class Test {
	public static void main(String[] args) {
		int v1 = 3;
		/* illegal implicit convert to narrowest type:
		 * byte v2 = v1;
		 *
		 * must be explicit cast: */
		byte v2 = (byte)v1;
		/* or the same type:
		 * int v2 = v1
		 */
		
		System.out.println(v2);
		v1 = 256;
		byte v3 = (byte) v1;
		System.out.println(v3);
		int v4 = 's';
		System.out.println(v4);
		
		byte v5 = 115;
		if (v5 == 's') {
			System.out.println("Equals");
		}
		
		System.out.println((double)4); // 4.0
		
		double d = 5;
		System.out.println(d + 1); // 6.0
		
		/* illegal convert from integer type to boolean
		 * ( number types can't be converted to boolean ) :
		 * boolean b = v4;
		 * must be: */
		int b = v4;
		/*
		 * or with 'toggle' such as:
		 * boolean b_ = Boolean.parseBoolean(v4 + "");
		 */
		
		/* illegal convert from string type to short:
		 * short v6 = "short";
		 * must be short type: */
		short v6 = 1000;
		/* or such like this:
		 * short v6 = Short.parseShort("short");
		 * or 
		 * short v6 = (short)"short".length();
		 */
		
		/* illegal convert from double to float:
		* float v7 = 3.67;
		* must be: */
		float v7 = 3.67f;
		/* or explicit convert:
		 * float v7_ = (float)3.67;
		 */
		
		float v9 = 3;
		/* reason of compilation error is the possibility to convert from int types
		 * to float with implicit cast to float */
		
		/* illegal convert from float to integer type
		 * int v8 = v7;
		 * must be explicit cast (with rounding down): */
		int v8 = (int)v7;
		/* or the same type:
		 * int v8 = 4;
		 * int v8 = 3; 
		 */
		
		/* it's incoorect:
		 * int array[] = new double["27"];
		/* 1. the construct-type must be the same type as link to array
		 * 2. the array length must be integer
		 */
		 int array[] = new int[27];
		
	}
}
